home *** CD-ROM | disk | FTP | other *** search
- #!/usr/sbin/perl
-
- # Grab the base script
- require "/usr/demos/Demo_Interfaces/Web/cgi-scripts/DEMO_base.cgi";
-
- # Colors
- $color = ".9 .5 .9";
- $highcolor = "1.0 .7 1.0";
-
-
-
-
- &list;
- &search;
-
-
- sub search {
- # This is a script that finds demos
- open(CMD, "/usr/sbin/slaunch -m \"Please enter search string:\"|");
- read(CMD, $query, 100);
- close(CMD);
- chop $query;
- foreach $num ( 0 .. $#demos ) {
- if ( "$query" eq "$demos[$num]" ) {
- chdir("$basedir/General_Demos");
- opendir(DIR, "$basedir/General_Demos/$query");
- if(grep(/\.m_.*/, readdir(DIR))) {
- $execute = "$basedir/Demo_Interfaces/Buttonfly/mkmenu related $query";
- $type = "top";
- } else {
- $execute = "$basedir/General_Demos/$query/RUN";
- $type = "bottom";
- }
- close(DIR);
- print "$query\n";
- print "\t.cd. $basedir/General_Demos/$query\n";
- print "\t$execute\n";
- if ( "$type" eq "top" ) {
- print "\t.menu. -\n";
- print "\t.popup. $query %t\n";
- print "\t.color. $color\n";
- print "\t.highcolor. $highcolor\n";
- } else {
- print "\t.popup. $query %t\n";
- print "\t.popup. Manual\n";
- print "\t$basedir/Demo_Interfaces/Buttonfly/mkmenu man $query\n";
- print "\t.popup. Information\n";
- print "\t$basedir/Demo_Interfaces/Buttonfly/mkmenu info $query\n";
- }
- $state = "good";
- }
- }
-
-
- if (!$state) {
- open(CMD, "/usr/bin/X11/xconfirm -header \"Find a Demo\" -B OK -b Search -icon info -t \"Demo not found: $query\"|");
- read(CMD, $ans, 100);
- close(CMD);
- chop $ans;
-
- if ( "$ans" eq "Search" ) {
- &search;
- }
-
- }
-
- }
-
-
- sub list {
- chdir("$basedir");
- opendir(DIR, "$basedir/General_Demos");
- @demos = (grep(!/^\.\.?$/, readdir(DIR)));
- closedir(DIR);
- @demos = sort @demos;
- return(@demos);
- }
-